package com.authsphere.plugin.base.entity;

import org.springframework.util.Assert;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @program: AuthSphere
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/29 22:00
 **/
public class AnnotationFieldBean<A extends Annotation> {

    private final A annotation;

    private final Field field;

    private final Method getterMethod;

    private final Method setterMethod;

    public AnnotationFieldBean(A annotation, Field field, Method getterMethod, Method setterMethod) {
        Assert.notNull(annotation, "annotation must not be null");
        Assert.notNull(field, "field must not be null");
        Assert.notNull(getterMethod, field.getName() + " getterMethod must not be null");
        Assert.notNull(setterMethod, field.getName() + " setterMethod must not be null");
        this.annotation = annotation;
        this.field = field;
        this.getterMethod = getterMethod;
        this.setterMethod = setterMethod;
    }

    public Field getField() {
        return field;
    }

    public Method getGetterMethod() {
        return getterMethod;
    }

    public Method getSetterMethod() {
        return setterMethod;
    }

    public A getAnnotation() {
        return annotation;
    }
}
